<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>practice</title>
</head>
<body>
    <div id="app">
        <input type="button" value="上一张" @click="previous" v-show="imageindex!=0">  <!-- v-if也可以 性能消耗有点大 -->
        <input type="button" value="下一张" @click="next" v-show="imageindex!=1">
        <img :src="imagearry[imageindex]" alt="">
        <h2>{{ imageindex}}</h2>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el:'#app',
            data:{
                imagearry:[
                    './01.png',
                    './01a.png'
                ],
                imageindex:1
            },
            methods:{
                next:function () {
                    this.imageindex++;
                },
                previous:function () {
                    this.imageindex--;
                }
            }
        })
    </script>
</body>
</html>